<?php
class CollectIndexAction extends AdminAction
{
	public function __construct()
	{
		parent::__construct();
		$this->responseType = 'tpl';
		$this->layout = 'admin';
	}

	public function execute()
	{
		$tmp		= C('ToolService')->request('Post','List',array('p'=>$this->getPage()));
		if($tmp===false)
		{
			$this->code	= 400;
		}
		else
		{
			$this->code	= $tmp['code'];
			
			$this->data	= $tmp['data'];
			if(array_key_exists('data',$this->data))
			{
				$count 		= $this->data['data']['count'];
				$baseUrl 	= C('LtUrl')->generate('Collect', 'Index', array('p' => ':page'));
				
				$pagination = new LtPagination;
				$pagination->init();
				$this->data['pages'] = $pagination->pager($this->getPage(), $count, $baseUrl);
			}
		}
		
		$this->data['menu']		= 'post';
		$this->data['submenu']	= 'post_collect';
	}
}
